package cate.game.activity.heroroad.msg;

import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.activity.heroroad.HeroRoad;
import cate.game.activity.specialtraining.SpecialTrainingActivity;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBHeroRoad;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "英雄之路领奖请求")
public class HeroRoadRewardReq implements MsgInput {
    @NoteField("奖励tid")
    public int tid;

    @NoteField("功能ID")
    public int funcId;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        HeroRoad heroRoad = cc.getRole().getActivity().getEnableActivitySingle(funcId);
        if (heroRoad != null) {
            GameResult<Void> r = heroRoad.gotReward(tid);
            game.notice.message(cc.getRole(), r, true);
        } else {
            game.notice.message(cc.getRole(), "活动未开启");
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBHeroRoad.GET_REWARD_REQ;
    }
}
